package com.shigen.demo.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shigen.demo.annotation.RequestLimit;
import com.shigen.demo.bean.Result;
import com.shigen.demo.entity.LoginLog;
import com.shigen.demo.entity.req.LoginLogReq;
import com.shigen.demo.service.impl.LoginLogServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "loginlog")
@Api(tags = "登录日志")
@RequestLimit
public class LoginLogController {

  @Resource
  private LoginLogServiceImpl loginLogService;

  @PostMapping(value = "select")
  @ApiOperation(value = "登录日志的id和location的分页查询")
  public Object selectAllLoginLogs(@RequestBody @Valid LoginLogReq.QueryItem queryInfo) {
    IPage<LoginLog> loginLogs = loginLogService.getLoginLogs(queryInfo);
    return Result.ok(loginLogs);
  }
}
